
public class TestCakeDecorator {

    public static void main(String[] args) {

        Cake cake = null;
        cake = new BaseCake();

        System.out.println(cake.getCakeMsg() + "，价格:" + cake.getPrice());

        cake = new CakeAddMangoDecorator(cake);
        System.out.println(cake.getCakeMsg() + "，价格:" + cake.getPrice());

        cake = new CakeAddGrapeDecorator(cake);
        System.out.println(cake.getCakeMsg() + "，价格:" + cake.getPrice());

        cake = new CakeAddMangoDecorator(cake);
        System.out.println(cake.getCakeMsg() + "，价格:" + cake.getPrice());
    }
}